package org.rust.lang;


public class TestRefs extends TestBase
{

   public void testVarAssign()
   {
      String prog = 
         "{"+
            "(i = 5)"+//TODO:Fix parser so that it will work without trailing space here
            "(i + 2)"+
         "}";
         assertEquals(7, execInt(prog));
   }

   public void testVarReAssign()
   {
      String prog = 
         "("+
            "(i = 5)"+
            "[i = 7]"+
            "(i + 2)"+
         ")";
         assertEquals(9, execInt(prog));
   }
   
   public void testVarToVarAssign()
   {
      String prog = 
         "("+
            "(i = 5) "+
            "(j = i) "+
            "(j + 2)"+
         ")";
         assertEquals(7, execInt(prog));
      
   }

   public void testVarToAssignAssign()
   {
      String prog = 
         "("+
            "(i = 5)"+
            "(j = (i + 5))"+
            "(j + 2)"+
         ")";
         assertEquals(12, execInt(prog));
      
   }

   public void testLots()
   {
      String prog = 
         "("+
            "(i = 5)"+
            "(j = 6)"+
            "(k = (j + 5 + i))"+
            "(i + j + k)"+
         ")";
         assertEquals(27, execInt(prog));
      
   }
}

